#include "EditorCore/Entity.h"

using namespace drawing;

namespace editor_core {

	int Entity::m_currentId = 0;

	const Color Entity::m_borderColorRegular( 1.0f, 0.0f, 0.0f );
	const Color Entity::m_borderColorSelected( 1.0f, 0.0f, 0.0f );
	const Color Entity::m_fillColorRegular( 1.0f, 1.0f, 1.0f );
	const Color Entity::m_fillColorSelected( 1.0f, 1.0f, 1.0f );

	const Pen Entity::m_regularPen( Entity::m_borderColorRegular, 1, PenStyle::Solid );
	const Pen Entity::m_selectedPen( Entity::m_borderColorSelected, 2, PenStyle::Solid );
	const Brush Entity::m_regularBrush( Entity::m_fillColorRegular, BrushStyle::Transparent );
	const Brush Entity::m_selectedBrush( Entity::m_fillColorSelected, BrushStyle::Transparent );

	Entity::Entity() :
		m_selected( false ),
		m_id( ++m_currentId )
	{}

	Entity::~Entity() {}

	void Entity::Draw( IDrawer* drawer ) {
		Pen pen = IsSelected() ? m_selectedPen : m_regularPen;
		Brush brush = IsSelected() ? m_selectedBrush : m_regularBrush;

		drawer->SetPen( pen );
		drawer->SetBrush( brush );

		DrawInner( drawer );
	}
}
